<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>${proj.projName }</title>
<link rel="shortcut icon" href="favicon.ico">
<!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>

<!-- 界面单独引入的其他样式和脚本 -->
<link rel="stylesheet"
	href="${path }/resource/plugin/zTree/zTreeStyle/zTreeStyle.css"
	type="text/css">
<script type="text/javascript"
	src="${path }/resource/plugin/zTree/jquery.ztree.core-3.5.min.js"></script>
<style type="text/css">
.hkdg {
	width: 100px;
	height: 100px;
	margin: 5px;
	border: 1px solid #aeaeae;
	border-radius: 5px;
	padding: 3px;
	margin: 5px;
}

blockquote {
	font-size: 14px;
	line-height: 25px;
}

.title {
	color: #6f5499;
	font-size: 32px;
	text-shadow: 2px 3px 2px #ababab;
}
</style>


</head>

<body class="gray-bg">
	<jsp:include page="_top.jsp"></jsp:include>

	<div class="wrapper wrapper-content  animated fadeInRight">
	<!-- 	<div class="row">
			<div class="col-sm-3">
				下载接口文档　<a class="btn btn-success" style="color: white;" 
					href="${path }/interface/download?projId=${projId}"> <i
					class="fa fa-download fa-lg"></i> Download
				</a>
			</div> -->
		</div>
		<br>
		<div class="row">
			<div class="col-sm-3">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>接口类型</h5>
						<div class="ibox-tools"></div>
					</div>
					<div id="treeDemo" class="ibox-content ztree"
						style="min-height: 400px"></div>
				</div>
			</div>
			<div class="col-sm-9">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>接口列表</h5>
						<div class="ibox-tools"></div>
					</div>
					<div class="ibox-content " style="min-height: 400px">
						<div id="ulList" class="list-group"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		var Huiform = null;
		$(function() {
			initFunctionList();
			Huiform = MValidform.validform("#dataform")
		});

		function initFunctionList() {
			var zNodes = new Array();
			$.AjaxProxy().invoke(
					"${path}/interface/interfaceCate/all?projId=${projId}",
					function(loj) {
						for (var i = 0; i < loj.getRowCount(); i++) {
							zNodes[i] = createNode(loj.getString(i, "id"), loj
									.getString(i, "parentId"), loj.getString(i,
									"name"));
						}
						initTree(zNodes);
					});
		}

		function initTree(zNodes) {
			var setting = {
				view : {
					dblClickExpand : false,
					showLine : false,
					selectedMulti : false
				},
				data : {
					simpleData : {
						enable : true,
						idKey : "id",
						pIdKey : "pId",
						rootPId : ""
					}
				},
				callback : {
					onClick : zTreeOnClick
				}
			};
			$.fn.zTree.init($("#treeDemo"), setting, zNodes);
		}

		// 点击加载节点信息
		function zTreeOnClick(event, treeId, treeNode) {
			$("#dataform").show();
			Huiform.resetForm();
			$
					.AjaxProxy({
						p : {
							cateId : treeNode.id
						},
						a : false,
						c : true
					})
					.invoke(
							"${path}/interface/interface/fidndAppInterFaceByCate",
							function(loj) {
								var html = "";
								for (var i = 0; i < loj.getRowCount(); i++) {
									html += '<a class="list-group-item" target="_blank" href="${path}/interface/showInterface?id='
											+ loj.getString(i, "id")
											+ '">'
											+ loj.getString(i, "name") + '</a>';
								}
								$("#ulList").html(html);
							});
		};

		function createNode(id, parentId, name) {
			var o = new Object();
			o.id = id;
			o.pId = parentId;
			o.name = name;
			o.open = true;
			return o;
		}
		
		
		
	</script>

</body>
</html>